﻿using System.Threading.Tasks;
using Jinjia.Approve.IRepository;
using Jinjia.Approve.IService.JJFlow.Condition;

namespace Jinjia.Approve.Service.JJFlow.Condition
{
    public class PaymentStartUserCondition : IJJCondition
    {
        private readonly IErpaBaseRepository _erpaBaseRepository;

        public PaymentStartUserCondition(IErpaBaseRepository erpaBaseRepository)
        {
            _erpaBaseRepository = erpaBaseRepository;
        }

        public async Task<bool> IsSatisfied(string biz_order_id, string depart_id = "0", string user_id = "0")
        {
            var model = await _erpaBaseRepository.GetModelByCodeType("payment_start_user");

            if (model != null && user_id == model.value)
            {
                return true;
            }

            return false;
        }
    }
}